import ajax from './index'

export interface SuggestionParams {
  keyword: string
  region?: string,
}

export interface Address {
  id: string,
  title: string,
  address: string,
  type: number,
  location: {
    lat: number,
    lng: number,
  },
  province: string,
  city: string,
  district: string
}

// export function getDistrict (): Promise<any> {
//   return ajax('/getDistrict')
// }

// export function getchildren (): Promise<any> {
//   return ajax('/getchildren')
// }

export function search (params: string): Promise<any> {
  return ajax('/search', { keyword: params })
}

export function mapSuggestion (params: SuggestionParams): Promise<Address[]> {
  return ajax('/mapSuggestion', params)
}
